<!--
 * @Author: coocase
 * @Date: 2021-06-21 17:15:57
 * @LastEditTime: 2021-06-21 18:13:49
 * @LastEditors: coocase
 * @Description: 
 * @FilePath: \git\dami\src\pages\pay\success.vue
-->
<template>
  <div class="wrap">
    <Steps :current="4">
      <Step title="选择商品"></Step>
      <Step title="确认订单信息"></Step>
      <Step title="支付订单"></Step>
      <Step title="支付成功"></Step>
    </Steps>
    <Card class="card">
      <p slot="title">
        <Icon type="ios-checkmark-circle-outline" style="color: #2dabf6" />
        您已支付成功付款
      </p>
      <div class="body">
        <li class="info">收获人: {{ name }}</li>
        <li class="info">
          联系电话: <span>{{ phone }}</span>
        </li>
        <li class="money">
          实付款: ￥<span>{{ price.minPrice }}</span>
        </li>
        <div class="link">
          您可以
          <a type="text" @click="jump">查看订单信息</a>
          <a @click="goTo">返回主页</a>
          <div class="tips">
            <Icon type="ios-alert" style="color: #2dabf6" />
            <span style="font-weight: bolder">安全提醒：</span>
            谨防假冒电话诈骗
          </div>
        </div>
      </div>
    </Card>
  </div>
</template>

<script>
import bus from "../../common/eventBus";
export default {
  name: "success",
  data() {
    return {
      money: "",
      //   form: {
      //     user: "",
      //     phone: "",
      //   },
      name: JSON.parse(localStorage.getItem("user")),
      phone: JSON.parse(localStorage.getItem("phone")),
      price: JSON.parse(localStorage.getItem("itemInfo")),
    };
  },
  created: function () {
    bus.$off("paydatas").$on("paydatas", (money, form) => {
      this.money = money;
      this.form = form;
      console.log(this.form);
    });
  },
  methods: {
    jump: function () {
      if (this.GLOBAL.hasLogin) {
        this.$router.push({ name: "Account" });
      } else {
        this.$Notice.error({
          title: "请登录",
          duration: 3,
        });
      }
    },
    goTo: function () {
      var path = this.$route.path;
      //当路径不是根目录，且不包含index时才跳转主页
      if (path != "/" && path.search("index") == -1) {
        this.$router.push({ name: "Index" });
      }
    },
  },
};
</script>

<style scoped>
.wrap {
  width: 1200px;
  margin: 20px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.card {
  margin: 50px;
  width: 500px;
  /* height: 200px; */
}
.body {
  margin: 30px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-direction: column;
}
.money span {
  color: #ff1268;
  font-weight: bolder;
}
.link {
  margin-top: 20px;
}
.orderManage {
  margin-top: 20px;
}
.tips {
  margin-top: 20px;
}
</style>